Skip to content

Conversation

FrankBoesing
Copy link
Contributor

if (1) log_e("error") produces a warning ("missing braces") and probably wrong code if no log level is defined.
This fixes that.

if (1) log_e("error") produces a warning ("missing braces") and probably wrong code if no log level is defined.
This fixes that.
@CLAassistant
Copy link

CLAassistant commented Nov 3, 2021

CLA assistant check
All committers have signed the CLA.

@me-no-dev me-no-dev merged commit 79e0889 into espressif:master Nov 4, 2021
@me-no-dev
Copy link
Member

Nice solution :)

@marcboon
Copy link

marcboon commented Nov 9, 2021

I've seen this solution before, but why 'do {} while(0)' instead of just '{}' ?

@FrankBoesing
Copy link
Contributor Author

Because this is a systax error:

#define foo {}

if (1) foo; 
else {}

This not:

#define foo do {} while(0)

if (1) foo; 
else {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants